<!DOCTYPE html>
<html>

<head>
  <title>Quarkus - Using Kogito to add business automation capabilities to an application</title>
  <script id="adobe_dtm" src="https://www.redhat.com/dtm.js" type="text/javascript"></script>
  <script src="/assets/javascript/highlight.pack.js" type="text/javascript"></script>
  <META HTTP-EQUIV='Content-Security-Policy' CONTENT="default-src 'none'; script-src 'self' 'unsafe-eval' 'sha256-ANpuoVzuSex6VhqpYgsG25OHWVA1I+F6aGU04LoI+5s=' 'sha256-ipy9P/3rZZW06mTLAR0EnXvxSNcnfSDPLDuh3kzbB1w=' js.bizographics.com https://www.redhat.com assets.adobedtm.com jsonip.com https://ajax.googleapis.com https://www.googletagmanager.com https://www.google-analytics.com https://use.fontawesome.com; style-src 'self' https://fonts.googleapis.com https://use.fontawesome.com; img-src 'self' *; media-src 'self' ; frame-src https://www.googletagmanager.com https://www.youtube.com; frame-ancestors 'none'; base-uri 'none'; object-src 'none'; form-action 'none'; font-src 'self' https://use.fontawesome.com https://fonts.gstatic.com;">
  <META HTTP-EQUIV='X-Frame-Options' CONTENT="DENY">
  <META HTTP-EQUIV='X-XSS-Protection' CONTENT="1; mode=block">
  <META HTTP-EQUIV='X-Content-Type-Options' CONTENT="nosniff">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="Quarkus: Supersonic Subatomic Java">
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:site" content="@QuarkusIO"> 
  <meta name="twitter:creator" content="@QuarkusIO">
  <meta property="og:url" content="https://quarkus.io/guides/kogito" />
  <meta property="og:title" content="Quarkus - Using Kogito to add business automation capabilities to an application" />
  <meta property="og:description" content="Quarkus: Supersonic Subatomic Java" />
  <meta property="og:image" content="/assets/images/quarkus_card.png" />
  <link rel="canonical" href="https://quarkus.io/guides/kogito">
  <link rel="shortcut icon" type="image/png" href="/favicon.ico" >
  <link rel="stylesheet" href="https://quarkus.io/guides/stylesheet/config.css" />
  <link rel="stylesheet" href="/assets/css/main.css" />
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
  <link rel="alternate" type="application/rss+xml"  href="https://quarkus.io/feed.xml" title="Quarkus">
  <script src="https://quarkus.io/assets/javascript/goan.js" type="text/javascript"></script>
  <script src="https://quarkus.io/assets/javascript/hl.js" type="text/javascript"></script>
</head>

<body class="guides">
  <!-- Google Tag Manager (noscript) -->
  <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NJWS5L"
  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  <!-- End Google Tag Manager (noscript) -->

  <div class="nav-wrapper">
  <div class="grid-wrapper">
    <div class="width-12-12">
      <input type="checkbox" id="checkbox" />
      <nav id="main-nav" class="main-nav">
  <div class="container">
    <div class="logo-wrapper">
      
        <a href="/"><img src="/assets/images/quarkus_logo_horizontal_rgb_600px_reverse.png" class="project-logo" title="Quarkus"></a>
      
    </div>
    <label class="nav-toggle" for="checkbox">
      <i class="fa fa-bars"></i>
    </label>
    <div id="menu" class="menu">
      <span>
        <a href="/get-started/" class="">Get Started</a>
      </span>
      <span>
        <a href="/guides/" class="active">Guides</a>
      </span>
      <span>
        <a href="/community/" class="">Community</a>
      </span>
      <span>
        <a href="/support/" class="">Support</a>
      </span>
      <span>
        <a href="/blog/" class="">Blog</a>
      </span>
      <span>
        <a href="https://code.quarkus.io" class="button-cta secondary white">Start Coding</a>
      </span>
    </div>
  </div>
      </nav>
    </div>
  </div>
</div>

  <div class="content">
    <div class="guide">
  <div class="width-12-12">
    <h1 class="text-caps">Quarkus - Using Kogito to add business automation capabilities to an application</h1>
    <div class="hide-mobile toc"><ul class="sectlevel1">
<li><a href="#prerequisites">Prerequisites</a>
<ul class="sectlevel2">
<li><a href="#install-modelling-plugins-in-your-ide">Install modelling plugins in your IDE</a></li>
</ul>
</li>
<li><a href="#architecture">Architecture</a>
<ul class="sectlevel2">
<li><a href="#business-process">Business process</a></li>
<li><a href="#business-rule">Business rule</a></li>
</ul>
</li>
<li><a href="#solution">Solution</a></li>
<li><a href="#creating-the-maven-project">Creating the Maven Project</a></li>
<li><a href="#writing-the-application">Writing the application</a></li>
<li><a href="#running-and-using-the-application">Running and Using the Application</a>
<ul class="sectlevel2">
<li><a href="#running-in-developer-mode">Running in Developer Mode</a></li>
<li><a href="#running-in-jvm-mode">Running in JVM Mode</a></li>
<li><a href="#running-in-native-mode">Running in Native Mode</a></li>
</ul>
</li>
<li><a href="#testing-the-application">Testing the Application</a></li>
<li><a href="#enabling-persistence">Enabling persistence</a>
<ul class="sectlevel2">
<li><a href="#prerequisites-2">Prerequisites</a></li>
<li><a href="#add-dependencies-to-project">Add dependencies to project</a></li>
<li><a href="#configure-connection-with-infinispan-server">Configure connection with Infinispan server</a></li>
<li><a href="#test-with-enabled-persistence">Test with enabled persistence</a></li>
</ul>
</li>
<li><a href="#using-decision-tables">Using decision tables</a></li>
<li><a href="#references">References</a></li>
</ul></div>
    <div>
      <div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>This guide demonstrates how your Quarkus application can use Kogito to add business automation
to power it up with business processes and rules.</p>
</div>
<div class="paragraph">
<p>Kogito is a next generation business automation toolkit that originates from well known Open Source projects
Drools (for business rules) and jBPM (for business processes). Kogito aims at providing another approach
to business automation where the main message is to expose your business knowledge (processes, rules and decisions)
in a domain specific way.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>This technology is considered preview.</p>
</div>
<div class="paragraph">
<p>In <em>preview</em>, backward compatibility and presence in the ecosystem is not guaranteed.
Specific improvements might require to change configuration or APIs and plans to become <em>stable</em> are under way.
Feedback is welcome on our <a href="https://groups.google.com/d/forum/quarkus-dev">mailing list</a> or as issues in our <a href="https://github.com/quarkusio/quarkus/issues">GitHub issue tracker</a>.</p>
</div>
<div class="paragraph">
<p>For a full list of possible extension statuses, check our <a href="https://quarkus.io/faq/#extension-status">FAQ entry</a>.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="prerequisites"><a class="anchor" href="#prerequisites"></a>Prerequisites</h2>
<div class="sectionbody">
<div class="paragraph">
<p>To complete this guide, you need:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>less than 15 minutes</p>
</li>
<li>
<p>an IDE (Eclipse is preferred with the BPMN modeller plugin)</p>
</li>
<li>
<p>JDK 1.8+ installed with <code>JAVA_HOME</code> configured appropriately</p>
</li>
<li>
<p>Apache Maven 3.6.2+</p>
</li>
<li>
<p>Docker</p>
</li>
</ul>
</div>
<div class="sect2">
<h3 id="install-modelling-plugins-in-your-ide"><a class="anchor" href="#install-modelling-plugins-in-your-ide"></a>Install modelling plugins in your IDE</h3>
<div class="paragraph">
<p>Kogito Tooling is currently supported in Eclipse and VSCode:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Eclipse</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>To be able to make use of visual modelling of your processes, download Eclipse IDE and
install from Market place Eclipse BPMN2 Modeller plugin (with jBPM Runtime Extension)</p>
</div>
<div class="ulist">
<ul>
<li>
<p>VSCode</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Download and install the VSCode Extension from <a href="https://github.com/kiegroup/kogito-tooling/releases">Kogito Tooling release page</a> to edit and model process definitions from VSCode IDE.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Online</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>To avoid any modeler installation you can use directly use <a href="https://bpmn.new">BPMN.new</a> to design and model your process through your favorite web browser.</p>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="architecture"><a class="anchor" href="#architecture"></a>Architecture</h2>
<div class="sectionbody">
<div class="paragraph">
<p>In this example, we build a very simple microservice which offers one REST endpoint:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>/persons</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>This endpoint will be automatically generated based on business process, that in turn will
make use of business rules to make certain decisions based on the data being processed.</p>
</div>
<div class="sect2">
<h3 id="business-process"><a class="anchor" href="#business-process"></a>Business process</h3>
<div class="paragraph">
<p>The business process will be responsible for encapsulating business logic of our microservice.
It should provide complete set of steps to achieve a business goal.
At the same time this is the entry point to the service that can be consumed by clients.</p>
</div>
</div>
<div class="sect2">
<h3 id="business-rule"><a class="anchor" href="#business-rule"></a>Business rule</h3>
<div class="paragraph">
<p>A business rule allows to externalise decision logic into reusable pieces that can be easily
used in declarative way. There are multiple ways of writing rules like decision tables,
decision trees, rules, etc. For this example we focus on the rule format backed by DRL
(Drools Rule Language).</p>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="solution"><a class="anchor" href="#solution"></a>Solution</h2>
<div class="sectionbody">
<div class="paragraph">
<p>We recommend that you follow the instructions in the next sections and create the application step by step.
However, you can go right to the complete example.</p>
</div>
<div class="paragraph">
<p>Clone the Git repository: <code>git clone <a href="https://github.com/quarkusio/quarkus-quickstarts.git" class="bare">https://github.com/quarkusio/quarkus-quickstarts.git</a></code>, or download an <a href="https://github.com/quarkusio/quarkus-quickstarts/archive/master.zip">archive</a>.</p>
</div>
<div class="paragraph">
<p>The solution is located in the <code>kogito-quickstart</code> <a href="https://github.com/quarkusio/quarkus-quickstarts/tree/master/kogito-quickstart">directory</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="creating-the-maven-project"><a class="anchor" href="#creating-the-maven-project"></a>Creating the Maven Project</h2>
<div class="sectionbody">
<div class="paragraph">
<p>First, we need a new project. Create a new project with the following command:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">mvn io.quarkus:quarkus-maven-plugin:1.7.0.Final:create \
    -DprojectGroupId=org.acme \
    -DprojectArtifactId=kogito-quickstart \
    -Dextensions="kogito"
cd kogito-quickstart</code></pre>
</div>
</div>
<div class="paragraph">
<p>This command generates a Maven project, importing the <code>kogito</code> extension
that comes with all needed dependencies and configuration to equip your application
with business automation.</p>
</div>
<div class="paragraph">
<p>If you already have your Quarkus project configured, you can add the <code>kogito</code> extension
to your project by running the following command in your project base directory:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">./mvnw quarkus:add-extension -Dextensions="kogito"</code></pre>
</div>
</div>
<div class="paragraph">
<p>This will add the following to your <code>pom.xml</code>:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="xml" class="language-xml hljs">&lt;dependency&gt;
    &lt;groupId&gt;org.kie.kogito&lt;/groupId&gt;
    &lt;artifactId&gt;kogito-quarkus&lt;/artifactId&gt;
&lt;/dependency&gt;</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="writing-the-application"><a class="anchor" href="#writing-the-application"></a>Writing the application</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Let&#8217;s start by implementing the simple data object <code>Person</code>. As you can see from the source code below it is just a POJO:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">package org.acme.kogito.model;

public class Person {

	private String name;
	private int age;
	private boolean adult;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public boolean isAdult() {
		return adult;
	}

	public void setAdult(boolean adult) {
		this.adult = adult;
	}

	@Override
	public String toString() {
		return "Person [name=" + name + ", age=" + age + ", adult=" + adult + "]";
	}

}</code></pre>
</div>
</div>
<div class="paragraph">
<p>Next, we create a rule file <code>person-rules.drl</code> inside the <code>src/main/resources/org/acme/kogito</code> folder of
the generated project.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="plain" class="language-plain hljs">package org.acme.kogito

import org.acme.kogito.model.Person;


rule "Is adult" ruleflow-group "person"

when
    $person: Person(age &gt; 18)
then
    modify($person) {
    	setAdult(true)
    };
end</code></pre>
</div>
</div>
<div class="paragraph">
<p>This is really a simple rule that marks a person who is older that 18 years as an adult.</p>
</div>
<div class="paragraph">
<p>Finally we create a business process that will make use of this rule and some other
activities to approve a given person. Using new item wizard (File &#8594; New &#8594; Other &#8594; BPMN2 Model)
create <code>persons.bpmn</code> inside <code>src/main/resources/org/acme/kogito</code> folder of the generated project.</p>
</div>
<div class="paragraph">
<p>This process should consist of</p>
</div>
<div class="ulist">
<ul>
<li>
<p>start event</p>
</li>
<li>
<p>business rule task</p>
</li>
<li>
<p>exclusive gateway</p>
</li>
<li>
<p>user task</p>
</li>
<li>
<p>end events</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>And should look like</p>
</div>
<div class="paragraph">
<p><span class="image"><img src="/guides/images/kogito-guide-screenshot.png" alt="Process definition"></span></p>
</div>
<div class="paragraph">
<p>To get started quickly copy the process definition from the
<a href="https://github.com/quarkusio/quarkus-quickstarts/tree/master/kogito-quickstart/src/main/resources/org/acme/kogito/persons.bpmn2">quickstart</a></p>
</div>
<div class="paragraph">
<p>To model this process yourself, just follow these steps (start event should be automatically added)</p>
</div>
<div class="ulist">
<ul>
<li>
<p>define a process variable with name <code>person</code> of type <code>org.acme.kogito.model.Person</code></p>
</li>
<li>
<p>drag the Tasks &#8594; Business Rule Task from the palette and drop it next to start event, link it with start event</p>
<div class="ulist">
<ul>
<li>
<p>double click on the business rule task</p>
<div class="ulist">
<ul>
<li>
<p>on tab I/O Parameters, set data input and output (map <code>person</code> process variable to input data with name <code>person</code> and same for data output)</p>
</li>
<li>
<p>on tab Business Rule Task, set rule flow group to the value defined in the drl file (<code>person</code>)</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li>
<p>drag the Gateways &#8594; XOR gateway from the palette and drop it next to the business rule task, link it with rule task</p>
</li>
<li>
<p>drag the Tasks &#8594; User Task from the palette and drop it next to the gateway, link it with gateway</p>
<div class="ulist">
<ul>
<li>
<p>double click on the user task</p>
<div class="ulist">
<ul>
<li>
<p>on tak User Task, set task name to <code>ChildrenHandling</code></p>
</li>
<li>
<p>on tab I/O Parameters, set data input (map <code>person</code> process variable to input data with name <code>person</code>)</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li>
<p>drag the End Events &#8594; End from the palette and drop it next to the user task, link it with the user task</p>
</li>
<li>
<p>drag the End Events &#8594; End from the palette and drop it next to the gateway, link it with the user task</p>
</li>
<li>
<p>double click on the gateway</p>
<div class="ulist">
<ul>
<li>
<p>on tab Gateway, set the diverging direction for the gateway</p>
</li>
<li>
<p>on tab Gateway, set conditions on sequence flow list</p>
<div class="ulist">
<ul>
<li>
<p>&#8594; going to end event <code>return person.isAdult() == true;</code> with language <code>Java</code></p>
</li>
<li>
<p>&#8594; going to user task <code>return person.isAdult() == false;</code> with language <code>Java</code></p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li>
<p>save the file</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="running-and-using-the-application"><a class="anchor" href="#running-and-using-the-application"></a>Running and Using the Application</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="running-in-developer-mode"><a class="anchor" href="#running-in-developer-mode"></a>Running in Developer Mode</h3>
<div class="paragraph">
<p>To run the microservice in dev mode, use <code>./mvnw clean compile quarkus:dev</code>.</p>
</div>
</div>
<div class="sect2">
<h3 id="running-in-jvm-mode"><a class="anchor" href="#running-in-jvm-mode"></a>Running in JVM Mode</h3>
<div class="paragraph">
<p>When you&#8217;re done playing with "dev-mode" you can run it as a standard Java application.</p>
</div>
<div class="paragraph">
<p>First compile it:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">./mvnw package</code></pre>
</div>
</div>
<div class="paragraph">
<p>Then run it:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">java -jar ./target/kogito-quickstart-runner.jar</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="running-in-native-mode"><a class="anchor" href="#running-in-native-mode"></a>Running in Native Mode</h3>
<div class="paragraph">
<p>This same demo can be compiled into native code: no modifications required.</p>
</div>
<div class="paragraph">
<p>This implies that you no longer need to install a JVM on your
production environment, as the runtime technology is included in
the produced binary, and optimized to run with minimal resource overhead.</p>
</div>
<div class="paragraph">
<p>Compilation will take a bit longer, so this step is disabled by default;
let&#8217;s build again by enabling the <code>native</code> profile:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">./mvnw package -Dnative</code></pre>
</div>
</div>
<div class="paragraph">
<p>After getting a cup of coffee, you&#8217;ll be able to run this binary directly:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">./target/kogito-quickstart-runner</code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="testing-the-application"><a class="anchor" href="#testing-the-application"></a>Testing the Application</h2>
<div class="sectionbody">
<div class="paragraph">
<p>To test your application, just send request to the service with giving the person as JSON
payload.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">curl -X POST http://localhost:8080/persons \
    -H 'content-type: application/json' \
    -H 'accept: application/json' \
    -d '{"person": {"name":"John Quark", "age": 20}}'</code></pre>
</div>
</div>
<div class="paragraph">
<p>In the response, the person should be approved as an adult and that should also be visible in the response payload.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="JSON" class="language-JSON hljs">{"id":"dace1d6a-a5fa-429d-b253-d6b66e265bbc","person":{"adult":true,"age":20,"name":"John Quark"}}</code></pre>
</div>
</div>
<div class="paragraph">
<p>You can also verify that there are no more active instances</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">curl -X GET http://localhost:8080/persons \
    -H 'content-type: application/json' \
    -H 'accept: application/json'</code></pre>
</div>
</div>
<div class="paragraph">
<p>To verify the non adult case, send another request with the age set to less than 18</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">curl -X POST http://localhost:8080/persons \
    -H 'content-type: application/json' \
    -H 'accept: application/json' \
    -d '{"person": {"name":"Jenny Quark", "age": 15}}'</code></pre>
</div>
</div>
<div class="paragraph">
<p>this time there should be one active instance, replace <code>{uuid}</code> with the id attribute taken from the response</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">curl -X GET http://localhost:8080/persons/{uuid}/tasks \
    -H 'content-type: application/json' \
    -H 'accept: application/json'</code></pre>
</div>
</div>
<div class="paragraph">
<p>You can get the details of the task by calling another endpoint, replace <code>uuids</code> with the values taken from
the responses (<code>uuid-1</code> is the process instance id and <code>uuid-2</code> is the task instance id).
First corresponds to the process instance id and the other to the task instance id.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">curl -X GET http://localhost:8080/persons/{uuid-1}/ChildrenHandling/{uuid-2} \
    -H 'content-type: application/json' \
    -H 'accept: application/json'</code></pre>
</div>
</div>
<div class="paragraph">
<p>You can complete this person evaluation process instance by calling the same endpoint but with POST,
replace <code>uuids</code> with the values taken from the responses (<code>uuid-1</code> is the process instance id and <code>uuid-2</code> is the task instance id).</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">curl -X POST http://localhost:8080/persons/{uuid-1}/ChildrenHandling/{uuid-2} \
    -H 'content-type: application/json' \
    -H 'accept: application/json' \
    -d '{}'</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="enabling-persistence"><a class="anchor" href="#enabling-persistence"></a>Enabling persistence</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Since 0.3.0 of Kogito, there is an option to enable persistence to preserve process instance state
across application restarts. That supports long running process instances that can be resumed at any
point in time.</p>
</div>
<div class="sect2">
<h3 id="prerequisites-2"><a class="anchor" href="#prerequisites-2"></a>Prerequisites</h3>
<div class="paragraph">
<p>Kogito uses Infinispan as the persistence service so you need to have Infinispan server installed and running.
Version of the Infinispan is aligned with Quarkus BOM so make sure the right version is installed.</p>
</div>
</div>
<div class="sect2">
<h3 id="add-dependencies-to-project"><a class="anchor" href="#add-dependencies-to-project"></a>Add dependencies to project</h3>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="xml" class="language-xml hljs">&lt;dependency&gt;
  &lt;groupId&gt;io.quarkus&lt;/groupId&gt;
  &lt;artifactId&gt;quarkus-infinispan-client&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
  &lt;groupId&gt;org.kie.kogito&lt;/groupId&gt;
  &lt;artifactId&gt;infinispan-persistence-addon&lt;/artifactId&gt;
  &lt;version&gt;${kogito.version}&lt;/version&gt;
&lt;/dependency&gt;</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="configure-connection-with-infinispan-server"><a class="anchor" href="#configure-connection-with-infinispan-server"></a>Configure connection with Infinispan server</h3>
<div class="paragraph">
<p>Add following into the src/main/resources/application.properties file (create the file if it does not exist)</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="plain" class="language-plain hljs">quarkus.infinispan-client.server-list=localhost:11222</code></pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
Adjust the host and port number according to your Infinispan server installation.
</td>
</tr>
</table>
</div>
</div>
<div class="sect2">
<h3 id="test-with-enabled-persistence"><a class="anchor" href="#test-with-enabled-persistence"></a>Test with enabled persistence</h3>
<div class="paragraph">
<p>After configuring persistence on the project level, you can test and verify that the process instance
state is preserved across application restarts.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>start Infinispan server</p>
</li>
<li>
<p>build and run your project</p>
</li>
<li>
<p>execute non adult use case</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">curl -X POST http://localhost:8080/persons \
    -H 'content-type: application/json' \
    -H 'accept: application/json' \
    -d '{"person": {"name":"Jenny Quark", "age": 15}}'</code></pre>
</div>
</div>
<div class="paragraph">
<p>You can also verify that there is active instance</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">curl -X GET http://localhost:8080/persons \
    -H 'content-type: application/json' \
    -H 'accept: application/json'</code></pre>
</div>
</div>
<div class="paragraph">
<p>Restart your application while keeping Infinispan server up and running.</p>
</div>
<div class="paragraph">
<p>Check if you can see active instance which should have exactly the same id</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">curl -X GET http://localhost:8080/persons \
    -H 'content-type: application/json' \
    -H 'accept: application/json'</code></pre>
</div>
</div>
<div class="paragraph">
<p>To learn more about persistence in Kogito visit <a href="https://github.com/kiegroup/kogito-runtimes/wiki/Persistence">this page</a></p>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="using-decision-tables"><a class="anchor" href="#using-decision-tables"></a>Using decision tables</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Kogito allows to define business rules as decision tables using the Microsoft Excel file formats.
To be able to use such assets in your application, an additional dependency is required:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="xml" class="language-xml hljs">&lt;dependency&gt;
    &lt;groupId&gt;org.kie.kogito&lt;/groupId&gt;
    &lt;artifactId&gt;drools-decisiontables&lt;/artifactId&gt;
&lt;/dependency&gt;</code></pre>
</div>
</div>
<div class="paragraph">
<p>Once the dependency is added to the project, decision tables in <code>xls</code> or <code>xlsx</code> format can be properly handled.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="references"><a class="anchor" href="#references"></a>References</h2>
<div class="sectionbody">
<div class="ulist">
<ul>
<li>
<p><a href="https://kogito.kie.org">Kogito Website</a></p>
</li>
<li>
<p><a href="https://docs.jboss.org/kogito/release/latest/html_single">Kogito Documentation</a></p>
</li>
</ul>
</div>
</div>
</div>
    </div>
  </div>
</div>

  </div>

  <div class="content project-footer">
  <div class="footer-section">
    <div class="logo-wrapper">
      <a href="/"><img src="/assets/images/quarkus_logo_horizontal_rgb_reverse.svg" class="project-logo" title="Quarkus"></a>
    </div>
  </div>
  <div class="grid-wrapper">
    <p class="grid__item width-3-12">Quarkus is open. All dependencies of this project are available under the <a href='https://www.apache.org/licenses/LICENSE-2.0' target='_blank'>Apache Software License 2.0</a> or compatible license.<br /><br />This website was built with <a href='https://jekyllrb.com/' target='_blank'>Jekyll</a>, is hosted on <a href='https://pages.github.com/' target='_blank'>Github Pages</a> and is completely open source. If you want to make it better, <a href='https://github.com/quarkusio/quarkusio.github.io' target='_blank'>fork the website</a> and show us what you’ve got.</p>

    
      <div class="width-1-12 project-links">
        <span>Navigation</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="/">Home</a></li>
          
            <li><a href="/guides">Guides</a></li>
          
            <li><a href="/community/#contributing">Contribute</a></li>
          
            <li><a href="/faq">FAQ</a></li>
          
            <li><a href="/get-started">Get Started</a></li>
          
        </ul>
      </div>
    
      <div class="width-1-12 project-links">
        <span>Contribute</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="https://twitter.com/quarkusio">Follow us</a></li>
          
            <li><a href="https://github.com/quarkusio">GitHub</a></li>
          
            <li><a href="/security">Security&nbsp;policy</a></li>
          
        </ul>
      </div>
    
      <div class="width-1-12 project-links">
        <span>Get Help</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="https://groups.google.com/forum/#!forum/quarkus-dev">Forums</a></li>
          
            <li><a href="https://quarkusio.zulipchat.com">Chatroom</a></li>
          
        </ul>
      </div>
    

    
      <div class="width-3-12 more-links">
        <span>Quarkus is made of community projects</span>
        <ul class="footer-links">
          
            <li><a href="https://vertx.io/" target="_blank">Eclipse Vert.x</a></li>
          
            <li><a href="https://microprofile.io" target="_blank">Eclipse MicroProfile</a></li>
          
            <li><a href="https://hibernate.org" target="_blank">Hibernate</a></li>
          
            <li><a href="https://netty.io" target="_blank">Netty</a></li>
          
            <li><a href="https://resteasy.github.io" target="_blank">RESTEasy</a></li>
          
            <li><a href="https://camel.apache.org" target="_blank">Apache Camel</a></li>
          
            <li><a href="https://code.quarkus.io/" target="_blank">And many more...</a></li>
          
        </ul>
      </div>
    
  </div>
</div>
  <div class="content redhat-footer">
  <div class="grid-wrapper">
    <span class="licence">
      <i class="fab fa-creative-commons"></i><i class="fab fa-creative-commons-by"></i> <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC by 3.0</a> | <a href="https://www.redhat.com/en/about/privacy-policy">Privacy Policy</a>
    </span>
    <span class="redhat">
      Sponsored by
    </span>
    <span class="redhat-logo">
      <a href="https://www.redhat.com/" target="_blank"><img src="/assets/images/redhat_reversed.svg"></a>
    </span>
  </div>
</div>


  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" integrity="sha384-8gBf6Y4YYq7Jx97PIqmTwLPin4hxIzQw5aDmUg/DDhul9fFpbbLcLh3nTIIDJKhx" crossorigin="anonymous"></script>
  <script type="text/javascript" src="/assets/javascript/mobile-nav.js"></script>
  <script type="text/javascript" src="/assets/javascript/scroll-down.js"></script>
  <script src="/assets/javascript/satellite.js" type="text/javascript"></script>
  <script src="https://quarkus.io/guides/javascript/config.js" type="text/javascript"></script>
  <script src="/assets/javascript/search-filter.js" type="text/javascript"></script>
  <script src="/assets/javascript/back-to-top.js" type="text/javascript"></script>
</body>

</html>
